import json
from keras.layers import Input
from mask_rcnn.mask_rcnn import MASK_RCNN
from PIL import Image
import numpy as np
import cv2

points = [
        [
            2326,
            6394
        ],
        [
            2376,
            6259
        ],
        [
            2410,
            6269
        ],
        [
            2361,
            6404
        ],
        [
            2326,
            6394
        ]
    ]
cnt2 = np.array([points], np.int32)

compareImgPath='D:\\PythonInPackage\\flaskProject\\static\\myImages\mask\\0.jpg'
compareImg=cv2.imread(compareImgPath,0)

_,contours,hierarchy= cv2.findContours(compareImg,cv2.RETR_TREE,1)
print(type(contours))
contours.sort(key=lambda c: cv2.contourArea(c), reverse=True)
cnt1 = contours[0]


ret = cv2.matchShapes(cnt1,cnt2,1,0.0)
print(ret)
# ret = cv2.matchShapes(cnt1,cnt2,1,0.0)

